package com.yunkaweilai.android.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.text.Html;
import android.view.View;
import android.widget.TextView;

import com.yunkaweilai.android.R;
import com.yunkaweilai.android.interfaces.MyDialogInterface;


/**
 * 通用dialog
 * MyDialogInterface 为接口
 * 取消确定按钮
 * Created by K on 2019/07/15
 */

public class MyDialog extends Dialog{
    private TextView id_tv_max_type;
    private TextView idTvContent;
    private TextView idTvRight;
    private TextView idTvClose;
    private MyDialogInterface mMyDialogInterface;
    private String title;
    private String content;
    public MyDialog(@NonNull Context context, MyDialogInterface MyDialogInterface, String title , String content) {
        super(context, R.style.dialog);
        this.title = title;
        this.content = content;
        this.mMyDialogInterface = MyDialogInterface;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_points_change);
        id_tv_max_type = ((TextView) findViewById(R.id.id_tv_max_type));
        id_tv_max_type.setText(Html.fromHtml(title));
        idTvContent = ((TextView) findViewById(R.id.id_tv_content));
        idTvContent.setText(Html.fromHtml(content));
        idTvRight = ((TextView) findViewById(R.id.id_tv_right));
        idTvRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mMyDialogInterface.RightClick();
                dismiss();
            }
        });
        idTvClose = ((TextView) findViewById(R.id.id_tv_close));
        idTvClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mMyDialogInterface.CancelClick();
                dismiss();
            }
        });

    }

}
